<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Admin\Subject;
use App\Admin\Sections;

class SubjectsController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $result = Subject::all()->map(function ($item) {
            $item['open'] = true;

            return $item;
        });
        $data = [];
        $data['code'] = 0;
        $data['msg'] = '';
        $data['count'] = count($result);
        $data['data'] = $result;
        return $data;
        //
    }
    public function sections()
    {
        $result = Sections::all();
        $data = [];
        $data['code'] = 0;
        $data['msg'] = '';
        $data['count'] = count($result);
        $data['data'] = $result;
        return $data;

        //
    }

}
